package we3d.renderer 
{
	import we3d.View3d;
	import we3d.layer.Layer;
	import we3d.mesh.Face;
	
	public class ZSort implements IPolyRenderer 
	{
		public function ZSort () {}
		
		public var scc:Number = 0.00000000000001;
		private var sc:Number=0;
		
		public function drawPoly (view:View3d, p:Face) :void {
			var lyr:Layer = view.currentLayer;
			p.z = 1/(lyr.cd*p.ax + lyr.ch*p.ay + lyr.cl*p.az + lyr.cp + sc + p.sortFar);
			lyr.polys[lyr.pCount++] = p;
			sc += scc;
		}
		
	}
	
}